package com.rc.saas.tenant.common.enums;


/**
 * Create by Yang on 2021/7/23
 * 枪口状态
 */
public enum DcGunStatusEnum {

    GUN_CODE_0X00(0x00,"空闲"),
    GUN_CODE_0X01(0x01,"预约 (预约状态时平台不可再下发充电指令"),
    GUN_CODE_0X02(0x02,"开始放电"),
    GUN_CODE_0X03(0x03,"充电中"),
    GUN_CODE_0X04(0x04,"过压 "),
    GUN_CODE_0X05(0x05,"欠压"),
    GUN_CODE_0X06(0x06,"过流"),
    GUN_CODE_0X07(0x07,"急停"),
    GUN_CODE_0X08(0x08,"充电完成"),
    GUN_CODE_0X09(0x09,"充电连接异常"),
    GUN_CODE_0X0A(0x0A,"充电机故障"),
    GUN_CODE_0X0B(0x0B,"BMS通信故障"),
    GUN_CODE_0X0C(0x0C,"枪已连接到车辆"),
    GUN_CODE_0X0D(0x0D,"枪锁异常"),
    GUN_CODE_0X0E(0x0E,"桩门异常"),
    ;


    private Integer code;
    private String msg;

    DcGunStatusEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    /**
     * 获取故障码
     * @param code
     * @return
     */
    public static String getDcFaultCode(int code){
        Class<YkrPileStopReasonEnum> enumClass = YkrPileStopReasonEnum.class;
        for (YkrPileStopReasonEnum elecPileStopReasonEnum : enumClass.getEnumConstants()) {
            if (code == elecPileStopReasonEnum.getCode()) {
                return elecPileStopReasonEnum.getMsg();
            }
        }
        return "该停止方式未知:" + code;

    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
